/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.misena.praxispraktik.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author SENA
 */
@Entity
@Table(name = "solicitudes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Solicitudes.findAll", query = "SELECT s FROM Solicitudes s"),
    @NamedQuery(name = "Solicitudes.findByIdVisitas", query = "SELECT s FROM Solicitudes s WHERE s.idVisitas = :idVisitas"),
    @NamedQuery(name = "Solicitudes.findByMotivo", query = "SELECT s FROM Solicitudes s WHERE s.motivo = :motivo"),
    @NamedQuery(name = "Solicitudes.findByFecha", query = "SELECT s FROM Solicitudes s WHERE s.fecha = :fecha"),
    @NamedQuery(name = "Solicitudes.findByHora", query = "SELECT s FROM Solicitudes s WHERE s.hora = :hora")})
public class Solicitudes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idVisitas")
    private Integer idVisitas;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "motivo")
    private String motivo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hora")
    @Temporal(TemporalType.TIME)
    private Date hora;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idVisitas")
    private Collection<Seguimientos> seguimientosCollection;
    @JoinColumn(name = "idPracticas", referencedColumnName = "idPracticas")
    @ManyToOne(optional = false)
    private Practicas idPracticas;

    public Solicitudes() {
    }

    public Solicitudes(Integer idVisitas) {
        this.idVisitas = idVisitas;
    }

    public Solicitudes(Integer idVisitas, String motivo, Date fecha, Date hora) {
        this.idVisitas = idVisitas;
        this.motivo = motivo;
        this.fecha = fecha;
        this.hora = hora;
    }

    public Integer getIdVisitas() {
        return idVisitas;
    }

    public void setIdVisitas(Integer idVisitas) {
        this.idVisitas = idVisitas;
    }

    public String getMotivo() {
        return motivo;
    }

    public void setMotivo(String motivo) {
        this.motivo = motivo;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    @XmlTransient
    public Collection<Seguimientos> getSeguimientosCollection() {
        return seguimientosCollection;
    }

    public void setSeguimientosCollection(Collection<Seguimientos> seguimientosCollection) {
        this.seguimientosCollection = seguimientosCollection;
    }

    public Practicas getIdPracticas() {
        return idPracticas;
    }

    public void setIdPracticas(Practicas idPracticas) {
        this.idPracticas = idPracticas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVisitas != null ? idVisitas.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Solicitudes)) {
            return false;
        }
        Solicitudes other = (Solicitudes) object;
        if ((this.idVisitas == null && other.idVisitas != null) || (this.idVisitas != null && !this.idVisitas.equals(other.idVisitas))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.praxispraktik.entity.Solicitudes[ idVisitas=" + idVisitas + " ]";
    }
    
}
